package com.shrw.duke.bluetoothheartrate.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by rw-duke on 2017/11/6.
 */

public class StateEntity implements Parcelable {
    private char active_region;//激活区    0：表示不在激活区  1：表示在激活区
    private char voltage;//电压   0：表示电压正常    1：表示电压低
    private char anti_dismantle;//防拆    0：防拆正常  1：防拆异常
    private char button;//按钮    0：按钮按下  1：按钮没按下
    private char vibrating_sensor;//振动传感器   0：无振动   1：振动
    private char retain;//保留
    private char open_receive;//打开接收    0：接收关闭  1：接收打开
    private char electricity_sign;//上电标志    0：正常    1：上电（复位防拆时清零）

    public StateEntity(){}

    public StateEntity(char[] stateArray) {
        this.active_region = stateArray[0];
        this.voltage = stateArray[1];
        this.anti_dismantle = stateArray[2];
        this.button = stateArray[3];
        this.vibrating_sensor = stateArray[4];
        this.retain = stateArray[5];
        this.open_receive = stateArray[6];
        this.electricity_sign = stateArray[7];
    }

    public StateEntity(char active_region, char voltage, char anti_dismantle, char button, char vibrating_sensor, char retain, char open_receive, char electricity_sign) {
        this.active_region = active_region;
        this.voltage = voltage;
        this.anti_dismantle = anti_dismantle;
        this.button = button;
        this.vibrating_sensor = vibrating_sensor;
        this.retain = retain;
        this.open_receive = open_receive;
        this.electricity_sign = electricity_sign;
    }

    public char getActive_region() {
        return active_region;
    }

    public void setActive_region(char active_region) {
        this.active_region = active_region;
    }

    public char getVoltage() {
        return voltage;
    }

    public void setVoltage(char voltage) {
        this.voltage = voltage;
    }

    public char getAnti_dismantle() {
        return anti_dismantle;
    }

    public void setAnti_dismantle(char anti_dismantle) {
        this.anti_dismantle = anti_dismantle;
    }

    public char getButton() {
        return button;
    }

    public void setButton(char button) {
        this.button = button;
    }

    public char getVibrating_sensor() {
        return vibrating_sensor;
    }

    public void setVibrating_sensor(char vibrating_sensor) {
        this.vibrating_sensor = vibrating_sensor;
    }

    public char getRetain() {
        return retain;
    }

    public void setRetain(char retain) {
        this.retain = retain;
    }

    public char getOpen_receive() {
        return open_receive;
    }

    public void setOpen_receive(char open_receive) {
        this.open_receive = open_receive;
    }

    public char getElectricity_sign() {
        return electricity_sign;
    }

    public void setElectricity_sign(char electricity_sign) {
        this.electricity_sign = electricity_sign;
    }


    @Override
    public String toString() {
        return "StatusBean{" +
                "active_region=" + active_region +
                ", voltage=" + voltage +
                ", anti_dismantle=" + anti_dismantle +
                ", button=" + button +
                ", vibrating_sensor=" + vibrating_sensor +
                ", retain=" + retain +
                ", open_receive=" + open_receive +
                ", electricity_sign=" + electricity_sign +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.active_region);
        dest.writeInt(this.voltage);
        dest.writeInt(this.anti_dismantle);
        dest.writeInt(this.button);
        dest.writeInt(this.vibrating_sensor);
        dest.writeInt(this.retain);
        dest.writeInt(this.open_receive);
        dest.writeInt(this.electricity_sign);
    }

    protected StateEntity(Parcel in) {
        this.active_region = (char) in.readInt();
        this.voltage = (char) in.readInt();
        this.anti_dismantle = (char) in.readInt();
        this.button = (char) in.readInt();
        this.vibrating_sensor = (char) in.readInt();
        this.retain = (char) in.readInt();
        this.open_receive = (char) in.readInt();
        this.electricity_sign = (char) in.readInt();
    }

    public static final Creator<StateEntity> CREATOR = new Creator<StateEntity>() {
        @Override
        public StateEntity createFromParcel(Parcel source) {
            return new StateEntity(source);
        }

        @Override
        public StateEntity[] newArray(int size) {
            return new StateEntity[size];
        }
    };
}
